/*
 * @(#)MaintHolidayGenerationForm.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.setup.web;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.web.AbstractActionForm;
import com.dcivision.setup.bean.HolidayRecord;

/**
 * MaintHolidayGenerationForm.java
 * 
 * This class is the for web form purpose.
 * 
 * @author Weison Liang
 * @company DCIVision Limited
 * @creation date 30/03/2005
 * @version $Revision: 1.4 $
 */

public class MaintHolidayGenerationForm extends AbstractActionForm {

  public static final String REVISION = "$Revision: 1.4 $";

  private String workingCalendarID = null;
  private String holidayName = null;
  private String holidayType = null;
  private String startDate = null;
  private String endDate = null;
  private String description = null;
  private String referenceFlag = null;
  private String year=null;

  private String dayOff1 = HolidayRecord.DAY_OFF_FULL;
  private String dayOff2 = HolidayRecord.DAY_OFF_NONE;
  private String dayOff3 = HolidayRecord.DAY_OFF_NONE;
  private String dayOff4 = HolidayRecord.DAY_OFF_NONE;
  private String dayOff5 = HolidayRecord.DAY_OFF_NONE;
  private String dayOff6 = HolidayRecord.DAY_OFF_NONE;
  private String dayOff7 = HolidayRecord.DAY_OFF_FULL;

  private String []referenceList=null;

  public MaintHolidayGenerationForm() {
    super();
  }

  public String getWorkingCalendarID() {
    return(this.workingCalendarID);
  }

  public void setWorkingCalendarID(String workingCalendarID) {
    this.workingCalendarID = workingCalendarID;
  }

  public String getHolidayName() {
    return(this.holidayName);
  }

  public void setHolidayName(String holidayName) {
    this.holidayName = holidayName;
  }

  public String getHolidayType() {
    return(this.holidayType);
  }

  public void setHolidayType(String holidayType) {
    this.holidayType = holidayType;
  }

  public String getStartDate() {
    return(this.startDate);
  }

  public void setStartDate(String startDate) {
    this.startDate = startDate;
  }

  public String getEndDate() {
    return(this.endDate);
  }

  public void setEndDate(String endDate) {
    this.endDate = endDate;
  }

  public String getDescription() {
    return(this.description);
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public String getReferenceFlag() {
    return(this.referenceFlag);
  }

  public void setReferenceFlag(String referenceFlag) {
    this.referenceFlag = referenceFlag;
  }

  public String getYear() {
    return(this.year);
  }

  public void setYear(String year) {
    this.year = year;
  }

  /**
   * @return Returns the dayOff1.
   */
  public String getDayOff1() {
    return dayOff1;
  }
  /**
   * @param dayOff1 The dayOff1 to set.
   */
  public void setDayOff1(String dayOff1) {
    this.dayOff1 = dayOff1;
  }
  /**
   * @return Returns the dayOff2.
   */
  public String getDayOff2() {
    return dayOff2;
  }
  /**
   * @param dayOff2 The dayOff2 to set.
   */
  public void setDayOff2(String dayOff2) {
    this.dayOff2 = dayOff2;
  }
  /**
   * @return Returns the dayOff3.
   */
  public String getDayOff3() {
    return dayOff3;
  }
  /**
   * @param dayOff3 The dayOff3 to set.
   */
  public void setDayOff3(String dayOff3) {
    this.dayOff3 = dayOff3;
  }
  /**
   * @return Returns the dayOff4.
   */
  public String getDayOff4() {
    return dayOff4;
  }
  /**
   * @param dayOff4 The dayOff4 to set.
   */
  public void setDayOff4(String dayOff4) {
    this.dayOff4 = dayOff4;
  }
  /**
   * @return Returns the dayOff5.
   */
  public String getDayOff5() {
    return dayOff5;
  }
  /**
   * @param dayOff5 The dayOff5 to set.
   */
  public void setDayOff5(String dayOff5) {
    this.dayOff5 = dayOff5;
  }
  /**
   * @return Returns the dayOff6.
   */
  public String getDayOff6() {
    return dayOff6;
  }
  /**
   * @param dayOff6 The dayOff6 to set.
   */
  public void setDayOff6(String dayOff6) {
    this.dayOff6 = dayOff6;
  }
  /**
   * @return Returns the dayOff7.
   */
  public String getDayOff7() {
    return dayOff7;
  }
  /**
   * @param dayOff7 The dayOff7 to set.
   */
  public void setDayOff7(String dayOff7) {
    this.dayOff7 = dayOff7;
  }

  public String[] getReferenceList(){
    return this.referenceList;
  }

  public void setReferenceList(String[] referenceList){
    this.referenceList=referenceList;
  }

  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return super.validate(mapping, request);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    this.setID(null);
    this.setWorkingCalendarID(null);
    this.setHolidayName(null);
    this.setHolidayType(null);
    this.setStartDate(null);
    this.setEndDate(null);
    this.setDescription(null);
    this.setReferenceFlag(null);
    this.setRecordStatus(null);
    this.setUpdateCount(null);
    this.setCreatorID(null);
    this.setCreateDate(null);
    this.setUpdaterID(null);
    this.setUpdateDate(null);
  }

  public AbstractBaseObject getFormData() throws ApplicationException {
    HolidayRecord tmpHolidayRecord = new HolidayRecord();
    tmpHolidayRecord.setID(TextUtility.parseIntegerObj(this.getID()));
    tmpHolidayRecord.setWorkingCalendarID(TextUtility.parseIntegerObj(this.getWorkingCalendarID()));
    tmpHolidayRecord.setHolidayName(this.getHolidayName());
    tmpHolidayRecord.setHolidayType(TextUtility.parseIntegerObj(this.getHolidayType()));
    tmpHolidayRecord.setStartDate(parseTimestamp(this.getStartDate()));
    tmpHolidayRecord.setEndDate(parseTimestamp(this.getEndDate()));
    tmpHolidayRecord.setDescription(this.getDescription());
    tmpHolidayRecord.setReferenceFlag(this.getReferenceFlag());
    tmpHolidayRecord.setRecordStatus(this.getRecordStatus());
    tmpHolidayRecord.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
    tmpHolidayRecord.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
    tmpHolidayRecord.setCreateDate(parseTimestamp(this.getCreateDate()));
    tmpHolidayRecord.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
    tmpHolidayRecord.setUpdateDate(parseTimestamp(this.getUpdateDate()));
    return tmpHolidayRecord;
  }

  public void setFormData(AbstractBaseObject baseObj) throws ApplicationException {
    HolidayRecord tmpHolidayRecord = (HolidayRecord)baseObj;
    this.setID(TextUtility.formatIntegerObj(tmpHolidayRecord.getID()));
    this.setWorkingCalendarID(TextUtility.formatIntegerObj(tmpHolidayRecord.getWorkingCalendarID()));
    this.setHolidayName(tmpHolidayRecord.getHolidayName());
    this.setHolidayType(TextUtility.formatIntegerObj(tmpHolidayRecord.getHolidayType()));
    this.setStartDate(formatTimestamp(tmpHolidayRecord.getStartDate()));
    this.setEndDate(formatTimestamp(tmpHolidayRecord.getEndDate()));
    this.setDescription(tmpHolidayRecord.getDescription());
    this.setReferenceFlag(tmpHolidayRecord.getReferenceFlag());
    this.setRecordStatus(tmpHolidayRecord.getRecordStatus());
    this.setUpdateCount(TextUtility.formatIntegerObj(tmpHolidayRecord.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(tmpHolidayRecord.getCreatorID()));
    this.setCreateDate(formatTimestamp(tmpHolidayRecord.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(tmpHolidayRecord.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(tmpHolidayRecord.getUpdateDate()));
  }
}
